// This is autogenerated file. Do not edit!

package models.autogenerated;

class Auth
{
	var db : orm.Db;
	var orm : models.Orm;
	public var privkey : String;
	public var devicekey : String;
	public var user_id : String;
	public var last_use : String;

	public function new(db:orm.Db, orm:models.Orm) : Void
	{
		this.db = db;
		this.orm = orm;
	}

	public function set(devicekey:String, user_id:String, last_use:String) : Void
	{
		this.devicekey = devicekey;
		this.user_id = user_id;
		this.last_use = last_use;
	}

	public function save() : Void
	{
		db.query(
			 'UPDATE `auth` SET '
				+  '`devicekey` = ' + db.quote(devicekey)
				+', `user_id` = ' + db.quote(user_id)
				+', `last_use` = ' + db.quote(last_use)
			+' WHERE `privkey` = ' + db.quote(privkey)
			+' LIMIT 1'
		);
	}
}